package com.zh.onlineexam.service.impl;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zh.onlineexam.entity.TExamRecord;
import com.zh.onlineexam.entity.TInfoTextContent;
import com.zh.onlineexam.entity.User;
import com.zh.onlineexam.mapper.TExamRecordMapper;
import com.zh.onlineexam.service.TExamRecordService;
import com.zh.onlineexam.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className TExamRecordServiceImpl
 * @Description TODO
 * @Auther 29934
 * @Date 2022/9/1 20:45
 * @Version 1.0
 **/
@Service
@RequiredArgsConstructor
public class TExamRecordServiceImpl extends ServiceImpl<TExamRecordMapper, TExamRecord> implements TExamRecordService {

    private final UserService userService;

    @Override
    public void saveExamRecords(List<TInfoTextContent> list, User user,int flagBit) {
        list.forEach(a -> {
            this.save(new TExamRecord(null,a.getId(), DateUtil.date(),1,user.getRealName(),flagBit));
        });
    }
}
